﻿using System.Collections.Generic;
using System.IO;

namespace Mitosoft.Definitions.Services
{
  /// <summary>
  /// Should be implemented by services providing directories information.
  /// </summary>
  public interface IDirectoryService
  {
    /// <summary>
    /// Gets the root directories.
    /// </summary>
    List<string> RootDirectories { get; }

    /// <summary>
    /// Gets all top subdirectories of the given path.
    /// </summary>
    /// <param name="path">Represents the path of the directory we want to get the top subdirectories.</param>
    /// <returns>Found top sub directories or null if the given path is empty/null or it does not exist.</returns>
    List<string> GetAllTopSubDirectories(string path);

    /// <summary>
    /// Gets the directories of the given path.
    /// </summary>
    /// <param name="path">Starting path to get the contained directories.</param>
    /// <param name="searchPattern">Use "*.*" to select all files or use a custom pattern.</param>
    /// <param name="searchOption">Determines whether to select either recursively all directories or
    /// only the directories contained in the given path.</param>
    /// <returns>Found directories or null if the given path is empty/null or it does not exist.</returns>
    List<string> GetDirectories(string path, string searchPattern, SearchOption searchOption);

    /// <summary>
    /// Gets the files belonging to the given directory.
    /// </summary>
    /// <param name="directoryPath">Path of the directory we want to know which files it contains.</param>
    /// <param name="searchPattern">Pattern used to filter the search results.</param>
    /// <returns>Found files or null if an error occured.</returns>
    List<string> GetDirectoryFiles(string directoryPath, string searchPattern = "*.*");
  }
}
